// pages/address/index.js
const Page = require('../../../utils/ald-stat.js').Page;
const app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    msg:'',
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
  
  },


  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    var that=this;
    var object = {
      unionid: wx.getStorageSync('openid'),
    }
    var sign = app.sort_ASCII(object)
    wx.request({
      url: app.globalData.new_url + '/userinfo/Userinfo/address',
      data: {
        unionid: wx.getStorageSync('openid'),
        sign:sign
      },
      method: 'POST',
      header: {
        'content-type': 'application/json'
      },
      success: function (res) {
        console.log(res)
        if(res.data.code===200){
          that.setData({
            msg: res.data.res
          })
        }
      }
    })
  },
  onUnload: function () {
    let pages = getCurrentPages();
    let prevPage = pages[0]
    if (prevPage.route == "pages/tarbar/my/index") {
      prevPage.setData({
        isShowInterstitialAd: 100,
      })
    }
  },
  editAddress:function(){
    wx.navigateTo({
      url: '/pages/main/editAdd/index',
    })
  },
})